package pl.pw.mkmw.pnganimator.gui;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author Michał
 */
public class FilterImages  extends FileFilter {

    //Accept all directories and all bmp, jpg or png files.
    public boolean accept(File f) {
        if (f.isDirectory()) {
            return true;
        }

        String extension = Utils.getExtension(f);
        if (extension != null) {
            if (
                extension.equals(Utils.bmp) ||    
                extension.equals(Utils.jpeg) ||
                extension.equals(Utils.jpg) ||
                extension.equals(Utils.png) ) {
                    return true;
            } else {
                return false;
            }
        }

        return false;
    }

    //The description of this filter
    public String getDescription() {
        return "Image files (.bmp .jpeg .jpg .png)";
    }
}